<html>
<head><meta charset="utf-8"><title>Enhanced typing · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html">Enhanced typing</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="188583663"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188583663" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188583663">(Feb 19 2020 at 20:46)</a>:</h4>
<p>I think this is a bug. I don't get automatic <code>///</code> when I type enter after an empty line in the middle of the comment.<br>
<a href="/user_uploads/4715/bKlLRoahFp1tYB30Jo1gE1my/bug.gif" target="_blank" title="bug.gif">bug.gif</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/bKlLRoahFp1tYB30Jo1gE1my/bug.gif" target="_blank" title="bug.gif"><img src="/user_uploads/4715/bKlLRoahFp1tYB30Jo1gE1my/bug.gif"></a></div>



<a name="188584700"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188584700" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188584700">(Feb 19 2020 at 20:59)</a>:</h4>
<p>You need to move the cursor to the right.</p>



<a name="188584752"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188584752" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188584752">(Feb 19 2020 at 20:59)</a>:</h4>
<p>It works after <code>/// </code>, but not after <code>///</code></p>



<a name="188585154"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188585154" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188585154">(Feb 19 2020 at 21:04)</a>:</h4>
<p><a href="https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/typing.rs#L49-L52" target="_blank" title="https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/typing.rs#L49-L52">https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ra_ide/src/typing.rs#L49-L52</a> this check seems suspicious</p>



<a name="188616057"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188616057" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188616057">(Feb 20 2020 at 07:40)</a>:</h4>
<p>The one above it, actually</p>



<a name="188620233"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188620233" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188620233">(Feb 20 2020 at 09:04)</a>:</h4>
<p>Yeah, I wonder why we add +1 there...</p>



<a name="188620358"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188620358" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188620358">(Feb 20 2020 at 09:06)</a>:</h4>
<p>PR is called <a href="https://github.com/rust-analyzer/rust-analyzer/pull/2350/files" target="_blank" title="https://github.com/rust-analyzer/rust-analyzer/pull/2350/files">Don't continue line comments</a>, <span class="user-mention" data-user-id="133169">@matklad</span>  maybe you can tell?</p>



<a name="188620386"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188620386" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188620386">(Feb 20 2020 at 09:06)</a>:</h4>
<p>Well, the prefix is <code>///</code>, so the condition looks all right to me because it's using <code>&lt;</code></p>



<a name="188620408"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188620408" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188620408">(Feb 20 2020 at 09:06)</a>:</h4>
<p>I tried to remove the <code>+ 1</code> and it works, but inserts an extra space on the next line</p>



<a name="188620419"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188620419" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188620419">(Feb 20 2020 at 09:07)</a>:</h4>
<p>(which is normal, but annoying)</p>



<a name="188620535"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188620535" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188620535">(Feb 20 2020 at 09:08)</a>:</h4>
<p>The code below adds the prefix and a space, so I guess we should only add the space if the part to the right of the cursor doesn't start with a space</p>



<a name="188620561"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188620561" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188620561">(Feb 20 2020 at 09:09)</a>:</h4>
<p>I don't think this is annoying. Writing comments without putting spaces after <code>///</code> is generally a bad practice</p>



<a name="188620669"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188620669" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188620669">(Feb 20 2020 at 09:10)</a>:</h4>
<p>That's not what I meant. If I press enter here: <code>///&lt;|&gt; hello</code>, the added line will say <code>/// &lt;|&gt; hello</code> because it copies over the text to the right of the cursor but also adds the space. It should say <code>/// &lt;|&gt; hello</code> or <code>///&lt;|&gt; hello</code>. This is after removing that <code> + TextUnit::from(1)</code>, of course.</p>



<a name="188620679"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188620679" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188620679">(Feb 20 2020 at 09:10)</a>:</h4>
<p>An annoyance that I see is that on_enter bails when you don't have that space after <code>///</code> which is not rare when you have <code>"files.trimTrailingWhitespace": true,</code></p>



<a name="188620782"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188620782" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188620782">(Feb 20 2020 at 09:12)</a>:</h4>
<p><span class="user-mention silent" data-user-id="203546">Laurențiu Nicola</span> <a href="#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Enhanced.20typing/near/188620669" title="#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Enhanced.20typing/near/188620669">said</a>:</p>
<blockquote>
<p>That's not what I meant. If I press enter here: <code>///&lt;|&gt; hello</code>, the added line will say <code>/// &lt;|&gt; hello</code> because it copies over the text to the right of the cursor but also adds the space. It should say <code>/// &lt;|&gt; hello</code> or <code>///&lt;|&gt; hello</code>.</p>
</blockquote>
<p>Hmm, that is controversial</p>



<a name="188620872"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188620872" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188620872">(Feb 20 2020 at 09:13)</a>:</h4>
<p>Actually typescript on_enter does the same</p>



<a name="188620925"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188620925" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188620925">(Feb 20 2020 at 09:14)</a>:</h4>
<p>When you press enter in doc comment it does unconditionally add that space</p>



<a name="188620928"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188620928" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188620928">(Feb 20 2020 at 09:14)</a>:</h4>
<p>TypeScript has block comments? <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="188620949"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188620949" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188620949">(Feb 20 2020 at 09:14)</a>:</h4>
<p>Yes, it does. Well, I guess we can remove that <code> + TextUnit::from(1)</code>, even though I'm not sure why.</p>



<a name="188620969"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188620969" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188620969">(Feb 20 2020 at 09:14)</a>:</h4>
<p>They are not in ECMAScript standard. It is a pervasive convention to write </p>
<div class="codehilite"><pre><span></span>/**
 *
 */
</pre></div>



<a name="188621021"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188621021" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188621021">(Feb 20 2020 at 09:15)</a>:</h4>
<p>And I do like this style of comments more, Rust even supports it...</p>



<a name="188621171"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188621171" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188621171">(Feb 20 2020 at 09:17)</a>:</h4>
<p>Ah, actually I think it's correct to remove it. Sorry, bit tired. <code>offset &lt; start + len</code> means that the cursor is inside the prefix. They'll be equal when the cursor is on <code>///&lt;|&gt;</code></p>



<a name="188621321"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188621321" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188621321">(Feb 20 2020 at 09:19)</a>:</h4>
<p>Sure, tho let's get an approval from the author of this function anyway</p>



<a name="188687230"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188687230" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188687230">(Feb 20 2020 at 22:46)</a>:</h4>
<p>Also, one more flaw that I have noticed is that auto comment insertion doesn't work with multi-cursors:</p>



<a name="188687377"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188687377" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188687377">(Feb 20 2020 at 22:48)</a>:</h4>
<p><a href="/user_uploads/4715/iDBP7GGfp88X2ecu3gRppyp9/multi-cursor-enter.gif" target="_blank" title="multi-cursor-enter.gif">multi-cursor-enter.gif</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/iDBP7GGfp88X2ecu3gRppyp9/multi-cursor-enter.gif" target="_blank" title="multi-cursor-enter.gif"><img src="/user_uploads/4715/iDBP7GGfp88X2ecu3gRppyp9/multi-cursor-enter.gif"></a></div>



<a name="188687510"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188687510" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188687510">(Feb 20 2020 at 22:50)</a>:</h4>
<p>This is how it works in TS for comparison:<br>
<a href="/user_uploads/4715/5Ztw6VNXxhiQbTNoKRzpyhD3/multi-cursor-enter-ts.gif" target="_blank" title="multi-cursor-enter-ts.gif">multi-cursor-enter-ts.gif</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/5Ztw6VNXxhiQbTNoKRzpyhD3/multi-cursor-enter-ts.gif" target="_blank" title="multi-cursor-enter-ts.gif"><img src="/user_uploads/4715/5Ztw6VNXxhiQbTNoKRzpyhD3/multi-cursor-enter-ts.gif"></a></div>



<a name="188687926"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188687926" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188687926">(Feb 20 2020 at 22:56)</a>:</h4>
<p>I'll try to look at TypeScript implementation and see what we can do here</p>



<a name="188687946"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188687946" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188687946">(Feb 20 2020 at 22:56)</a>:</h4>
<p>Because enhanced typing has aggregated quite some controversy already...</p>



<a name="188688995"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188688995" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188688995">(Feb 20 2020 at 23:11)</a>:</h4>
<p><a href="https://github.com/microsoft/vscode/blob/c93155b6439be83358a54df520cb508c814f1d9a/extensions/typescript-language-features/src/features/languageConfiguration.ts#L15-L52" target="_blank" title="https://github.com/microsoft/vscode/blob/c93155b6439be83358a54df520cb508c814f1d9a/extensions/typescript-language-features/src/features/languageConfiguration.ts#L15-L52">This is</a> where they do it</p>



<a name="188689016"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188689016" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188689016">(Feb 20 2020 at 23:11)</a>:</h4>
<p>This happens not on lsp side...</p>



<a name="188689305"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188689305" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188689305">(Feb 20 2020 at 23:15)</a>:</h4>
<p><span class="user-mention" data-user-id="133169">@matklad</span> , should we do the same on our TypeScript extension? Since I heard LSP doesn't support pushing edits anyway... Otherwise users have a lot of problems with our custom on_enter implementation (<a href="https://github.com/rust-analyzer/rust-analyzer/issues/3253" target="_blank" title="https://github.com/rust-analyzer/rust-analyzer/issues/3253">one</a>, <a href="https://github.com/rust-analyzer/rust-analyzer/issues/3013" target="_blank" title="https://github.com/rust-analyzer/rust-analyzer/issues/3013">two</a>)...</p>



<a name="188690185"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188690185" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188690185">(Feb 20 2020 at 23:28)</a>:</h4>
<p>That's quite nifty</p>



<a name="188690192"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188690192" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188690192">(Feb 20 2020 at 23:28)</a>:</h4>
<p>We shall not use regular expressions for parsing Rust.</p>



<a name="188690227"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188690227" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188690227">(Feb 20 2020 at 23:29)</a>:</h4>
<p>It arguably won't work in raw strings, but it's not so bad otherwise</p>



<a name="188690698"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188690698" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188690698">(Feb 20 2020 at 23:37)</a>:</h4>
<p>That is the API provided by VSCode, if you don't want native Regexp, we can implement our own since this is just an interface (but I wouldn''t)... Anyway this is not about parsing, just brainless text manipulations...</p>



<a name="188691199"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188691199" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188691199">(Feb 20 2020 at 23:44)</a>:</h4>
<p><span class="user-mention" data-user-id="133169">@matklad</span> , RLS <a href="https://github.com/rust-lang/rls-vscode/blob/ffe36f31b7a7105c6127f44e407dd828f94d1709/src/extension.ts#L500-L541" target="_blank" title="https://github.com/rust-lang/rls-vscode/blob/ffe36f31b7a7105c6127f44e407dd828f94d1709/src/extension.ts#L500-L541">does the same thing</a>...</p>



<a name="188691648"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188691648" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188691648">(Feb 20 2020 at 23:51)</a>:</h4>
<p>I do strongly believe that using regular expressions in any capacity for analyzing a programming language is a step back. if we can't user the proper technology (incremental parser), we should push for removing the blockers for using the proper technology, and not implement a workaround. </p>
<p>That's a tad too idealistic, and I agree that, to derive the most value to the most users <strong>now</strong> we should just go with what's default for VS Code (and, for example, completely ignore syntax highlighting until it is stabilized). I don't want to do that partially just because it goes against my personal value, and paritally becaues I think pushing for the right thing will lead to the more value overall.</p>



<a name="188691900"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188691900" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188691900">(Feb 20 2020 at 23:55)</a>:</h4>
<p>Like, that's literary the original story behind rust-analyzer:</p>
<p>I've implemented the "Run this test" in RLS. I had to use regular expression, because I didn't have access to the parser. As I had  a half-written Rust parser for libsyntax2 at that moment, I've decided that it would be  a good use of my time to push that parser to 80% ready state and to add an LSP on top of it¸just so that I can have one-shortcut test running functionality, based on a real parser:</p>
<p><a href="https://github.com/rust-analyzer/rust-analyzer/commit/57518153147ad53639f16cc940d219dc582c550a" target="_blank" title="https://github.com/rust-analyzer/rust-analyzer/commit/57518153147ad53639f16cc940d219dc582c550a">https://github.com/rust-analyzer/rust-analyzer/commit/57518153147ad53639f16cc940d219dc582c550a</a></p>



<a name="188692371"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188692371" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188692371">(Feb 21 2020 at 00:01)</a>:</h4>
<p>Hm, I think the relevant commit is <a href="https://github.com/rust-analyzer/rust-analyzer/commit/36bd28633baf6015b767e9e70d2d53185271db50" target="_blank" title="https://github.com/rust-analyzer/rust-analyzer/commit/36bd28633baf6015b767e9e70d2d53185271db50">https://github.com/rust-analyzer/rust-analyzer/commit/36bd28633baf6015b767e9e70d2d53185271db50</a></p>
<p>Don't remember how they came along actually. Just re-learned that ruts-analyzer actually started as a native plugin for NodeJS, and not as a language server</p>



<a name="188692840"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188692840" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188692840">(Feb 21 2020 at 00:09)</a>:</h4>
<p>What is libsyntax2?</p>



<a name="188692909"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188692909" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188692909">(Feb 21 2020 at 00:10)</a>:</h4>
<p>Anyway, I won't go against anybody's personal value (except when it gets to semicolons)...</p>



<a name="188693762"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188693762" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188693762">(Feb 21 2020 at 00:25)</a>:</h4>
<p>Another option would be to listen for OnDidChangeTextDocument event, but this is emitted when the change is already applied... I'll try to see what we can do with this once I have time... Also note that multicursor support should be added, but later after we fix current issues</p>



<a name="188908757"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188908757" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188908757">(Feb 24 2020 at 08:53)</a>:</h4>
<p>I am genuinely stuck. We cannot implemented onEnter through OnDidChangeTextDocument event, since it is emitted when the document already contains the inserted newline character, moreover VSCode automatically prepends some whitespace for auto indentation which doesn't help at all...</p>



<a name="188908804"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188908804" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188908804">(Feb 24 2020 at 08:54)</a>:</h4>
<p>Moreover it is async, so that the user may outtype our server in theory</p>



<a name="188908910"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188908910" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188908910">(Feb 24 2020 at 08:56)</a>:</h4>
<p>I looked over the native vscode source that deals with those regexps and they do it using private access to DOM, since extension host has no direct access to it</p>



<a name="188909252"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188909252" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188909252">(Feb 24 2020 at 09:03)</a>:</h4>
<p>Another way to fix this would be to stay using the keybinding approach (or overriding the "default:type" command) and adding workarounds for each reported bug in isolation</p>



<a name="188909437"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188909437" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188909437">(Feb 24 2020 at 09:06)</a>:</h4>
<p>(By the way, even our current approach uses async code so that the onEnter handler is not reentrant in theory, which may cause data races)</p>



<a name="188910939"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188910939" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188910939">(Feb 24 2020 at 09:30)</a>:</h4>
<p>My "vote" would go towards the regex solution. It's less elegant, but is better integrated with the editor, and should work fine most of the time (e.g. even if you're typing a doc comment in a raw string, maybe you actually want the comment to be automatically extended). We're not parsing the full language, only recognizing comments. We already have a bunch of heuristics for other things. And, uh, you <a href="https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/5233151#5233151" target="_blank" title="https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/5233151#5233151">can</a> parse HTML with regexes <span aria-label="slight smile" class="emoji emoji-1f642" role="img" title="slight smile">:slight_smile:</span>.</p>



<a name="188914506"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188914506" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188914506">(Feb 24 2020 at 10:29)</a>:</h4>
<p><span class="user-mention" data-user-id="133169">@matklad</span> , what if we copy the regexeps setup from the RLS source, keep our <code>on_enter</code> implementation in <code>typing.rs</code> handler for better times and create an issue at VSCode to request a better support for our use case?<br>
This way we fix the bugs and even get the feature of multiple cursors and support for star-like block comments, i.e.:</p>
<div class="codehilite"><pre><span></span>/**
 *
 */
</pre></div>


<p>which do not work with our impl now...<br>
I am very sorry to ask you this once again, though I am not standing for this...</p>



<a name="188914914"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188914914" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188914914">(Feb 24 2020 at 10:36)</a>:</h4>
<p>I'd rather not add regexes .</p>



<a name="188917322"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188917322" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188917322">(Feb 24 2020 at 11:18)</a>:</h4>
<p>More generally, all language specific language should be implemented on the server side.</p>



<a name="188918083"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188918083" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188918083">(Feb 24 2020 at 11:33)</a>:</h4>
<p>Yeah, this is in ideal world, real world is complicated...</p>



<a name="188922231"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188922231" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremy Kolb <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188922231">(Feb 24 2020 at 12:50)</a>:</h4>
<p>Custom LSP request?</p>



<a name="188922257"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188922257" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremy Kolb <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188922257">(Feb 24 2020 at 12:50)</a>:</h4>
<p>though i think we have that for on enter</p>



<a name="188924554"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188924554" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188924554">(Feb 24 2020 at 13:18)</a>:</h4>
<p>is it really impossible to handle this asynchronously? wouldn't it be possible to insert whatever RA returns even if the user has typed a few more characters since then?</p>



<a name="188924589"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188924589" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188924589">(Feb 24 2020 at 13:19)</a>:</h4>
<p>it seems to me that that + doing nothing on error would alleviate most problems</p>



<a name="188924637"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188924637" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188924637">(Feb 24 2020 at 13:19)</a>:</h4>
<p>I think VS extensions run asynchronously, but I'm not sure if they can do edits like this. The issue is that you need to handle conflict resolution with later edits from the user.</p>



<a name="188924645"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188924645" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188924645">(Feb 24 2020 at 13:19)</a>:</h4>
<p>(+ some timeout, say 100ms, after which it doesn't really make sense to still insert it)</p>



<a name="188924699"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188924699" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188924699">(Feb 24 2020 at 13:20)</a>:</h4>
<blockquote>
<p>The issue is that you need to handle conflict resolution with later edits from the user.</p>
</blockquote>
<p>I know, what I'm saying is that maybe that's not really too hard in this specific case?</p>



<a name="188924807"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188924807" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188924807">(Feb 24 2020 at 13:21)</a>:</h4>
<p>Maybe "don't do anything if the user typed something", but can we even detect it?</p>



<a name="188925003"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188925003" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188925003">(Feb 24 2020 at 13:23)</a>:</h4>
<p>maybe keeping track of the cursor position where the newline was inserted, and replacing that afterwards? Of course checking that it's still a newline at that time</p>



<a name="188925049"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188925049" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188925049">(Feb 24 2020 at 13:24)</a>:</h4>
<p>I doubt users will be able to type anything that actually conflicts if we respond reasonably fast; usually they will type a few more letters after the newline</p>



<a name="188925138"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188925138" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188925138">(Feb 24 2020 at 13:24)</a>:</h4>
<p>I'm also worried about the response time when the system is busy, It's annoying enough that my mouse cursor lags when I'm compiling something, but to be fair that's a Gnome thing, and <code>rust-analyzer</code>'s enhanced typing is relatively snappy even in those circumstances.</p>



<a name="188925143"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188925143" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188925143">(Feb 24 2020 at 13:25)</a>:</h4>
<p>of course we could also just put a hard timeout of 16ms on the request, if it really has to be sychronous</p>



<a name="188925275"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188925275" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188925275">(Feb 24 2020 at 13:26)</a>:</h4>
<p>I think the <em>idea</em> is that it'll always be very fast. It'll certainly be pretty useless if it's not, so we can just skip it in those situations. But if we do it synchronously, the typing would still be slowed down by our timeout</p>



<a name="188925338"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188925338" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188925338">(Feb 24 2020 at 13:26)</a>:</h4>
<p>Agreed. Ideally it's going to be fast, but that's sometimes outside of our control.</p>



<a name="188925758"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188925758" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188925758">(Feb 24 2020 at 13:31)</a>:</h4>
<p>I can't find it, but there's an older issue about <code>onEnter</code> where somebody linked a related Code issue about extensions slowing down typing like this.</p>



<a name="188925833"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188925833" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188925833">(Feb 24 2020 at 13:32)</a>:</h4>
<p><a href="https://github.com/rust-analyzer/rust-analyzer/issues/2331#issuecomment-556993009" target="_blank" title="https://github.com/rust-analyzer/rust-analyzer/issues/2331#issuecomment-556993009">https://github.com/rust-analyzer/rust-analyzer/issues/2331#issuecomment-556993009</a></p>



<a name="188925916"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188925916" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188925916">(Feb 24 2020 at 13:33)</a>:</h4>
<p>That's pretty bad, if true</p>



<a name="188926113"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188926113" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188926113">(Feb 24 2020 at 13:36)</a>:</h4>
<blockquote>
<p>is it really impossible to handle this asynchronously? </p>
</blockquote>
<p>In theory, you can do very cool stuff here with operational transofmation, where server-generated edits race with user-initiated ones. In practice, I've just fixed two <strong>huge</strong> bugs with this feature, where we've blocked onEnter altogether if there were server errors, and that should alleviate most of the problems I think</p>



<a name="188926153"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188926153" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188926153">(Feb 24 2020 at 13:37)</a>:</h4>
<p><span class="user-mention" data-user-id="133169">@matklad</span> what do you think about DanTup's comment?</p>



<a name="188926284"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188926284" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188926284">(Feb 24 2020 at 13:39)</a>:</h4>
<blockquote>
<p>that also means that any other extensions that have code handlers firing from that key press</p>
</blockquote>
<p>Not only that, but I imagine it could be any handler running in a different extension</p>



<a name="188926424"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188926424" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188926424">(Feb 24 2020 at 13:41)</a>:</h4>
<p>Could our new infra with <code>onEnter</code> keypress alleviate this issue?</p>



<a name="188926767"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188926767" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188926767">(Feb 24 2020 at 13:43)</a>:</h4>
<p>Ultimately, I think this is an editor issue. VS Code simply does not have a proper architecture for synchroneous semantic things, like join/split lines, indentation-aware caret placement, etc. Ideally, it should be handled by either allowing truly synchronous actions, or by using OT-style async edit.</p>



<a name="188926830"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188926830" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188926830">(Feb 24 2020 at 13:44)</a>:</h4>
<p>For the time being, I am not too worried about that: as long as we do the right thing on the server, we should be able to catch up with whatever editor advencement happen</p>



<a name="188926831"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188926831" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188926831">(Feb 24 2020 at 13:44)</a>:</h4>
<p>Do you mean <a href="https://github.com/rust-lang/rust/issues/3289" target="_blank" title="https://github.com/rust-lang/rust/issues/3289">#3289</a>?</p>



<a name="188927019"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188927019" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188927019">(Feb 24 2020 at 13:46)</a>:</h4>
<p>I don't think so. After all, when there's no <code>onEnter</code> handler installed, Code can do its regex thing synchronously. If even a single extension sets one up, the editor will have to wait after the extension host to process everything. I wouldn't expect things to improve soon.</p>



<a name="188927359"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188927359" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188927359">(Feb 24 2020 at 13:51)</a>:</h4>
<p>VSCode does place indentation even without our onenter</p>



<a name="188927379"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188927379" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188927379">(Feb 24 2020 at 13:51)</a>:</h4>
<p>It just doesn't place comment prefixes automatically</p>



<a name="188927503"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188927503" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188927503">(Feb 24 2020 at 13:53)</a>:</h4>
<p>Also I do have a problem on startup, it's mostly perceivable in debug build. Some time before the bootstrap is finished my enter key presses don't put newlines and after some lag time they appear all at once</p>



<a name="188927577"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188927577" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188927577">(Feb 24 2020 at 13:54)</a>:</h4>
<p>Yeah, I've seen that (in release builds)</p>



<a name="188927613"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188927613" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188927613">(Feb 24 2020 at 13:55)</a>:</h4>
<blockquote>
<p>VSCode does place indentation even without our onenter</p>
</blockquote>
<p>It does it wrong</p>



<a name="188927644"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188927644" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188927644">(Feb 24 2020 at 13:55)</a>:</h4>
<p>I agree this is an editor issue. VSCode decided to use process per extension approach and as less synchronicity as possible in order to keep the editor responsive disregarding bad designed extensions</p>



<a name="188927829"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188927829" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188927829">(Feb 24 2020 at 13:58)</a>:</h4>
<blockquote>
<p>We measured the time taken for an ordinary (non-overridden) execution of the type command (which was roughly 20ms on my machine), vs. then calling 'default: type' command, which was always roughly 10x slower. Even though I am not familiar with the extensions API, this is puzzling, since these two calls should be doing exactly the same thing, yet calling executeCommand('default: type', ...) results in a much slower execution time of the default type command.</p>
</blockquote>



<a name="188927869"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188927869" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188927869">(Feb 24 2020 at 13:58)</a>:</h4>
<p>Ugh. From <a href="https://github.com/microsoft/vscode/issues/65876" target="_blank" title="https://github.com/microsoft/vscode/issues/65876">https://github.com/microsoft/vscode/issues/65876</a>, which is worth a read.</p>



<a name="188928049"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/188928049" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#188928049">(Feb 24 2020 at 14:00)</a>:</h4>
<p>Yeah, people do like to override the onInput handler <a href="https://github.com/microsoft/vscode/issues/65876" target="_blank" title="https://github.com/microsoft/vscode/issues/65876">https://github.com/microsoft/vscode/issues/65876</a></p>



<a name="189053132"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/189053132" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#189053132">(Feb 25 2020 at 19:41)</a>:</h4>
<p>Tried setting this condition for on_enter keybinding:</p>
<div class="codehilite"><pre><span></span>&quot;when&quot;: &quot;editorLangId == rust &amp;&amp; !suggestWidgetVisible &amp;&amp; (!vim.active || vim.mode == &#39;Insert&#39;)&quot;
</pre></div>


<p>But Vscode either doesn't support parentheses here or has a bug, since when I run the extension the condition get's transformed into an invalid expression:<br>
<a href="/user_uploads/4715/tIEiqSsGS7O1OBMIozVlpyK5/image.png" target="_blank" title="image.png">image.png</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/tIEiqSsGS7O1OBMIozVlpyK5/image.png" target="_blank" title="image.png"><img src="/user_uploads/4715/tIEiqSsGS7O1OBMIozVlpyK5/image.png"></a></div>



<a name="189056444"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/189056444" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#189056444">(Feb 25 2020 at 20:13)</a>:</h4>
<p>Created an issue at vscode repo regrading that: <a href="https://github.com/microsoft/vscode/issues/91473" target="_blank" title="https://github.com/microsoft/vscode/issues/91473">https://github.com/microsoft/vscode/issues/91473</a></p>



<a name="189058434"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/189058434" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#189058434">(Feb 25 2020 at 20:35)</a>:</h4>
<p>So.. <code>editorLangId == rust &amp;&amp; !suggestWidgetVisible &amp;&amp; !vim.active || editorLangId == rust &amp;&amp; !suggestWidgetVisible &amp;&amp; vim.mode == 'Insert'</code>?</p>



<a name="189059804"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/189059804" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#189059804">(Feb 25 2020 at 20:50)</a>:</h4>
<p>Yeah also thought about that, I guess this is the only possible workaround...</p>



<a name="189059854"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/189059854" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#189059854">(Feb 25 2020 at 20:51)</a>:</h4>
<p>But does it work?</p>



<a name="189059859"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/189059859" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#189059859">(Feb 25 2020 at 20:51)</a>:</h4>
<p>Gonna try now</p>



<a name="189060225"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/189060225" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#189060225">(Feb 25 2020 at 20:55)</a>:</h4>
<p>Yes it does. Though I am not 100% sure it will fix all vscode-vim issues. One user <a href="https://github.com/rust-analyzer/rust-analyzer/issues/3013#issuecomment-586989889" target="_blank" title="https://github.com/rust-analyzer/rust-analyzer/issues/3013#issuecomment-586989889">warned us</a> that vim extension provides text searching in insert mode which should also not trigger the newline...</p>



<a name="189060475"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/189060475" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#189060475">(Feb 25 2020 at 20:58)</a>:</h4>
<p>But I am a 0% vim user so won't bother that much...</p>



<a name="189061005"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/189061005" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#189061005">(Feb 25 2020 at 21:04)</a>:</h4>
<p>Ugh, how do I edit that condition? I tried to right-click and choose "Change When Expression", I can type (well, paste) it, but it doesn't seem to get committed on Enter</p>



<a name="189061080"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/189061080" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#189061080">(Feb 25 2020 at 21:05)</a>:</h4>
<p>Try this <a href="/user_uploads/4715/FKh9yTqPXnEbjy5OSfPgTiBC/image.png" target="_blank" title="image.png">image.png</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/FKh9yTqPXnEbjy5OSfPgTiBC/image.png" target="_blank" title="image.png"><img src="/user_uploads/4715/FKh9yTqPXnEbjy5OSfPgTiBC/image.png"></a></div>



<a name="189061249"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/189061249" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#189061249">(Feb 25 2020 at 21:07)</a>:</h4>
<p>What's <code>-rust-analyzer.onEnter</code>?</p>



<a name="189061310"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/189061310" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#189061310">(Feb 25 2020 at 21:08)</a>:</h4>
<p><a href="/user_uploads/4715/u4BeRaPopTG1AArHBskjb1W-/image.png" target="_blank" title="image.png">image.png</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/u4BeRaPopTG1AArHBskjb1W-/image.png" target="_blank" title="image.png"><img src="/user_uploads/4715/u4BeRaPopTG1AArHBskjb1W-/image.png"></a></div>



<a name="189061326"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/189061326" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#189061326">(Feb 25 2020 at 21:08)</a>:</h4>
<p>Not sure what happened <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="189061454"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/189061454" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#189061454">(Feb 25 2020 at 21:09)</a>:</h4>
<p>That's weird. I suppose that minus prefix for the command name disables the keybinding</p>



<a name="189061595"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/189061595" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#189061595">(Feb 25 2020 at 21:11)</a>:</h4>
<p>I have only one onEnter in my <strong>Default</strong> keybindnigs file (note that there are two of them: default an user-defined).</p>



<a name="189062850"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/189062850" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#189062850">(Feb 25 2020 at 21:24)</a>:</h4>
<p>Yeah, that's from my user-defined one</p>



<a name="189062879"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/189062879" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#189062879">(Feb 25 2020 at 21:25)</a>:</h4>
<p>I wanted to add <code>editorTextFocus</code> to that condition, but it doesn't seem to do much for the search case</p>



<a name="189063036"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/189063036" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#189063036">(Feb 25 2020 at 21:27)</a>:</h4>
<p>Also, this is very frustrating. I'm a mediocre Vim user, but the things I do in Vim don't work with this extension.</p>



<a name="189063066"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/189063066" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#189063066">(Feb 25 2020 at 21:27)</a>:</h4>
<p>I already created a <a href="https://github.com/rust-analyzer/rust-analyzer/pull/3308" target="_blank" title="https://github.com/rust-analyzer/rust-analyzer/pull/3308">PR</a>, or doesn't it actually work with the search mode?</p>



<a name="189063139"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/189063139" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#189063139">(Feb 25 2020 at 21:28)</a>:</h4>
<p>In the search mode. Have you tried it?</p>



<a name="189063220"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/189063220" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#189063220">(Feb 25 2020 at 21:29)</a>:</h4>
<p>I barely managed to get to the insert mode from the normal mode, are you kiddin?</p>



<a name="189063250"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/189063250" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#189063250">(Feb 25 2020 at 21:29)</a>:</h4>
<p>lol</p>



<a name="189063261"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/189063261" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#189063261">(Feb 25 2020 at 21:29)</a>:</h4>
<p>Press <code>/</code>, then type the text to search</p>



<a name="189063384"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/189063384" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#189063384">(Feb 25 2020 at 21:31)</a>:</h4>
<p>So this is why I couldn't write a comment...</p>



<a name="189063496"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/189063496" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#189063496">(Feb 25 2020 at 21:33)</a>:</h4>
<p>Hmm, when I type kyrillic  letters in normal mode it doesn't enter the insert mode...</p>



<a name="189063578"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/189063578" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#189063578">(Feb 25 2020 at 21:34)</a>:</h4>
<p>But you can enter the search input only from normal mode, right? So it does work in this case...</p>



<a name="189063601"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/189063601" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#189063601">(Feb 25 2020 at 21:34)</a>:</h4>
<p>lol again</p>



<a name="189063618"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/189063618" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#189063618">(Feb 25 2020 at 21:34)</a>:</h4>
<p>You need to press <code>i</code> to go from normal to insert mode, then ESC to get back to normal mode</p>



<a name="189063628"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/189063628" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#189063628">(Feb 25 2020 at 21:35)</a>:</h4>
<p><code>/</code> for search only works in normal mode</p>



<a name="189063779"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/189063779" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#189063779">(Feb 25 2020 at 21:36)</a>:</h4>
<p>Lol, when I type <code>/</code> character it types the character, but then deletes it and the latency is pretty noticeable (especially when you hold the key for some time)<br>
<a href="/user_uploads/4715/n23tlYtv5g9GkmwgX31HC8Sl/vim-bizzare.gif" target="_blank" title="vim-bizzare.gif">vim-bizzare.gif</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/n23tlYtv5g9GkmwgX31HC8Sl/vim-bizzare.gif" target="_blank" title="vim-bizzare.gif"><img src="/user_uploads/4715/n23tlYtv5g9GkmwgX31HC8Sl/vim-bizzare.gif"></a></div>



<a name="189063816"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/189063816" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#189063816">(Feb 25 2020 at 21:37)</a>:</h4>
<p>What? Does it go from normal to insert mode automatically?</p>



<a name="189063847"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/189063847" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#189063847">(Feb 25 2020 at 21:37)</a>:</h4>
<p>Yeah</p>



<a name="189063854"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/189063854" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#189063854">(Feb 25 2020 at 21:37)</a>:</h4>
<p>Try.. restarting Code? Or dunno. It's <code>i</code> on an US English keyboard, but I don't even know if you have that key...</p>



<a name="189063885"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/189063885" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#189063885">(Feb 25 2020 at 21:38)</a>:</h4>
<p>Maybe try changing your keyboard layout</p>



<a name="189063997"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/189063997" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#189063997">(Feb 25 2020 at 21:39)</a>:</h4>
<p>Of course it does!</p>



<a name="189063999"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/189063999" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#189063999">(Feb 25 2020 at 21:39)</a>:</h4>
<p><a href="/user_uploads/4715/j2dAteFSCjm4svmI_Sr5BmSH/IMG_20200225_233818.jpg" target="_blank" title="IMG_20200225_233818.jpg">IMG_20200225_233818.jpg</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/j2dAteFSCjm4svmI_Sr5BmSH/IMG_20200225_233818.jpg" target="_blank" title="IMG_20200225_233818.jpg"><img src="/user_uploads/4715/j2dAteFSCjm4svmI_Sr5BmSH/IMG_20200225_233818.jpg"></a></div>



<a name="189064147"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/189064147" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#189064147">(Feb 25 2020 at 21:40)</a>:</h4>
<p>That's... honestly better than the non-QWERTY layouts I've had to use.</p>



<a name="189064922"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/189064922" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#189064922">(Feb 25 2020 at 21:49)</a>:</h4>
<p>Anyway, I believe my amendment does work, since you can trigger the search only from the normal mode, right?</p>



<a name="189349444"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/189349444" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> std::Veetaha <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#189349444">(Feb 28 2020 at 20:48)</a>:</h4>
<p><span class="user-mention" data-user-id="133169">@matklad</span> can't we use <a href="https://code.visualstudio.com/api/language-extensions/programmatic-language-features#incrementally-format-code-as-the-user-types" target="_blank" title="https://code.visualstudio.com/api/language-extensions/programmatic-language-features#incrementally-format-code-as-the-user-types">formatting on-type feature</a> to implement the on-enter functionality?</p>



<a name="189349936"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/189349936" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#189349936">(Feb 28 2020 at 20:53)</a>:</h4>
<p>Last time I checked, no</p>



<a name="210572325"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Enhanced%20typing/near/210572325" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Enhanced.20typing.html#210572325">(Sep 18 2020 at 20:35)</a>:</h4>
<p>Opened <a href="https://github.com/rust-analyzer/rust-analyzer/pull/6037">https://github.com/rust-analyzer/rust-analyzer/pull/6037</a> to make it easier to re-enable this feature</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>